package com.example.loopyserver.controller;

import com.example.loopyserver.common.CommonController;
import com.example.loopyserver.po.KeywordRelationPO;
import com.example.loopyserver.server.KnowledgeGraphService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@CommonController
@RequiredArgsConstructor
@RequestMapping("/kg")
public class KnowledgeGraphController {
    private final KnowledgeGraphService knowledgeGraphService;

    @GetMapping("/associates")
    public List<KeywordRelationPO> getAssociates(@RequestParam String text) {
        return knowledgeGraphService.getAssociatesForKeywordInText(text);
    }
}
